package com.atguigu.petstore.coupon.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 优惠 - 劵信息
 * @TableName coupon_info
 */
@TableName(value ="coupon_info")
@Data
public class CouponInfo implements Serializable {
    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 优惠券标题（有图片则显示图片）：无门槛50元优惠券 | 单品最高减2000元
     */
    @TableField(value = "title")
    private String title;

    /**
     * 图片
     */
    @TableField(value = "icon")
    private String icon;

    /**
     * 可用于：10商品优惠券  20类目优惠券  30平台优惠券  40新人券
     */
    @TableField(value = "used")
    private Integer used;

    /**
     * 1满减券 2折扣券  3秒杀券
     */
    @TableField(value = "type")
    private Integer type;

    /**
     * 满多少金额
     */
    @TableField(value = "with_amount")
    private Integer withAmount;

    /**
     * 券抵金额（满减劵字段）
     */
    @TableField(value = "used_amount")
    private Integer usedAmount;

    /**
     * 券折扣（折扣券字段）
     */
    @TableField(value = "used_discount")
    private Integer usedDiscount;

    /**
     * 券指定金额（秒杀券字段）
     */
    @TableField(value = "used_price")
    private Integer usedPrice;

    /**
     * 配额：发券数量
     */
    @TableField(value = "quota")
    private Integer quota;

    /**
     * 已领取的优惠券数量
     */
    @TableField(value = "take_count")
    private Integer takeCount;

    /**
     * 已使用的优惠券数量
     */
    @TableField(value = "used_count")
    private Integer usedCount;

    /**
     * 发放开始时间
     */
    @TableField(value = "start_time")
    private Date startTime;

    /**
     * 发放结束时间
     */
    @TableField(value = "end_time")
    private Date endTime;

    /**
     * 时效:1绝对时效（领取后XXX-XXX时间段有效）  2相对时效（领取后N天有效）
     */
    @TableField(value = "valid_type")
    private Integer validType;

    /**
     * 使用开始时间
     */
    @TableField(value = "valid_start_time")
    private Date validStartTime;

    /**
     * 使用结束时间
     */
    @TableField(value = "valid_end_time")
    private Date validEndTime;

    /**
     * 自领取之日起有效天数
     */
    @TableField(value = "valid_days")
    private Integer validDays;

    /**
     * 1生效 2失效 3已结束
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 
     */
    @TableField(value = "create_user")
    private Long createUser;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date createTime;

    /**
     * 
     */
    @TableField(value = "update_user")
    private Long updateUser;

    /**
     * 修改时间
     */
    @TableField(value = "update_time")
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CouponInfo other = (CouponInfo) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getIcon() == null ? other.getIcon() == null : this.getIcon().equals(other.getIcon()))
            && (this.getUsed() == null ? other.getUsed() == null : this.getUsed().equals(other.getUsed()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getWithAmount() == null ? other.getWithAmount() == null : this.getWithAmount().equals(other.getWithAmount()))
            && (this.getUsedAmount() == null ? other.getUsedAmount() == null : this.getUsedAmount().equals(other.getUsedAmount()))
            && (this.getUsedDiscount() == null ? other.getUsedDiscount() == null : this.getUsedDiscount().equals(other.getUsedDiscount()))
            && (this.getUsedPrice() == null ? other.getUsedPrice() == null : this.getUsedPrice().equals(other.getUsedPrice()))
            && (this.getQuota() == null ? other.getQuota() == null : this.getQuota().equals(other.getQuota()))
            && (this.getTakeCount() == null ? other.getTakeCount() == null : this.getTakeCount().equals(other.getTakeCount()))
            && (this.getUsedCount() == null ? other.getUsedCount() == null : this.getUsedCount().equals(other.getUsedCount()))
            && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getValidType() == null ? other.getValidType() == null : this.getValidType().equals(other.getValidType()))
            && (this.getValidStartTime() == null ? other.getValidStartTime() == null : this.getValidStartTime().equals(other.getValidStartTime()))
            && (this.getValidEndTime() == null ? other.getValidEndTime() == null : this.getValidEndTime().equals(other.getValidEndTime()))
            && (this.getValidDays() == null ? other.getValidDays() == null : this.getValidDays().equals(other.getValidDays()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateUser() == null ? other.getUpdateUser() == null : this.getUpdateUser().equals(other.getUpdateUser()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getIcon() == null) ? 0 : getIcon().hashCode());
        result = prime * result + ((getUsed() == null) ? 0 : getUsed().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getWithAmount() == null) ? 0 : getWithAmount().hashCode());
        result = prime * result + ((getUsedAmount() == null) ? 0 : getUsedAmount().hashCode());
        result = prime * result + ((getUsedDiscount() == null) ? 0 : getUsedDiscount().hashCode());
        result = prime * result + ((getUsedPrice() == null) ? 0 : getUsedPrice().hashCode());
        result = prime * result + ((getQuota() == null) ? 0 : getQuota().hashCode());
        result = prime * result + ((getTakeCount() == null) ? 0 : getTakeCount().hashCode());
        result = prime * result + ((getUsedCount() == null) ? 0 : getUsedCount().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getValidType() == null) ? 0 : getValidType().hashCode());
        result = prime * result + ((getValidStartTime() == null) ? 0 : getValidStartTime().hashCode());
        result = prime * result + ((getValidEndTime() == null) ? 0 : getValidEndTime().hashCode());
        result = prime * result + ((getValidDays() == null) ? 0 : getValidDays().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateUser() == null) ? 0 : getUpdateUser().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", title=").append(title);
        sb.append(", icon=").append(icon);
        sb.append(", used=").append(used);
        sb.append(", type=").append(type);
        sb.append(", withAmount=").append(withAmount);
        sb.append(", usedAmount=").append(usedAmount);
        sb.append(", usedDiscount=").append(usedDiscount);
        sb.append(", usedPrice=").append(usedPrice);
        sb.append(", quota=").append(quota);
        sb.append(", takeCount=").append(takeCount);
        sb.append(", usedCount=").append(usedCount);
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append(", validType=").append(validType);
        sb.append(", validStartTime=").append(validStartTime);
        sb.append(", validEndTime=").append(validEndTime);
        sb.append(", validDays=").append(validDays);
        sb.append(", status=").append(status);
        sb.append(", createUser=").append(createUser);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateUser=").append(updateUser);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}